package com.team.controller;

import com.team.service.PermissionService;
import com.team.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * -*- coding:utf-8 -*-
 *
 * @author 太阳偷渡青山
 * @software IntelliJ IDEA
 * @date 2022/10/13 16:24
 * @Description
 */
@RestController
@RequestMapping("/permission")
public class PermissionController {
    @Autowired
    private PermissionService permissionService;

    /**
     * init初始化左菜单
     *
     * @author 太阳偷渡青山
     * @return {@link Result}
     */
    @RequestMapping("list")
    private Result initLeftMenu(){
        return permissionService.findByAdminId();
    }

    /**
     * 根据角色id查询角色所具有的权限id
     * @param id
     * @return
     */
    @GetMapping("role")
    private Result findByRoleId(Integer id){
        return permissionService.findByRoleId(id);
    }

    /**
     * 分配角色权限
     * @param id
     * @param integers
     * @return
     */
    @RequestMapping("/qr")
    public Result qr(Integer id,Integer[] integers){
        return permissionService.qr(id,integers);
    }
}
